<?php

namespace App\Modules\User;


use App\Modules\Users\Models\Visitor;
use Illuminate\Support\Facades\Redis;
use App\Library\Rank\AbstractSingleRank;
use App\Modules\User\Models\User;
use App\Modules\User\Models\UserReferrer;
use DB;

class ShareRank extends AbstractSingleRank
{
    protected static $key = "share_rank:";

    public static function refresh()
    {
        self::multi(function () {
            static::flush();
            User::query()
                ->orderBy('id')
                ->where('share', ">", 0)
                ->each(function ($item) {
                    static::update($item->id, $item->share);
                });
        });
    }
}
